package com.share.design.interpreter;

import lombok.AllArgsConstructor;

/**
 * bool类型常量
 * author:caifan
 * date:2020/2/6
 */
@AllArgsConstructor
public class Constant implements Expression {

    private boolean value;

    @Override
    public boolean interprete(Context context) {
        return value;
    }

    @Override
    public boolean equals(Object obj) {
        if(null != obj && obj instanceof Constant){
            return this.value == ((Constant)obj).value;
        }
        return false;
    }

    @Override
    public String toString() {
        return new Boolean(value).toString();
    }
}
